package dao;

import java.util.List;

import model.ProductImpl;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;

import stub.Product;


public class ProductDao{
	
	private HibernateTemplate	hibernateTemplate;
	
	
	public void setSessionFactory( SessionFactory sessionFactory ) {
		this.hibernateTemplate = new HibernateTemplate( sessionFactory );
	}
	
	@SuppressWarnings( "unchecked" )
	public List<Product> getProducts(){
		return hibernateTemplate.loadAll( ProductImpl.class );
	}

	public void addProduct(Product product){
		hibernateTemplate.save( product );
	}
}
